import { Component, Vue } from 'vue-property-decorator'
import styles from './ResultPage.less'

@Component({})
export default class ResultPage extends Vue {
  private isSuccess!: boolean
  private errMsg!: string
  created() {
    this.isSuccess = this.$route.query.success?.toString() === 'true'
    this.errMsg = this.$route.query.message?.toString()
  }
  get iconClass() {
    return this.isSuccess ? 'el-icon-circle-check' : 'el-icon-circle-close'
  }

  get statusTxt() {
    return this.isSuccess ? '绘制成功' : '绘制失败'
  }

  get noteTxt() {
    return this.isSuccess ? '请回到浙江省电子印章系统页面继续操作' : this.errMsg
  }
  render() {
    return (
      <div class={styles.resultPage}>
        <i class={this.iconClass} />
        <p class={styles.result}>{this.statusTxt}</p>
        <p class={styles.note}>{this.noteTxt}</p>
      </div>
    )
  }
}
